package iterator.example;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author：LJ
 * @Description：
 * @Date: 2017/12/1
 * @Modified By:
 */
public class Project implements IProject {
    private List<IProject> projectList = new ArrayList<IProject>();
    private String name = "";
    private int num = 0;
    private int cost = 0;

    public Project() {
    }

    public Project(String name, int num, int cost) {
        this.name = name;
        this.num = num;
        this.cost = cost;
    }

    @Override
    public void add(String name, int num, int cost) {
        projectList.add(new Project(name, num, cost));
    }

    @Override
    public String getProjectInfo() {
        return "项目名：" + name + "\t项目数量：" + num + "\t项目花销：" + cost;
    }

    @Override
    public IProjectIterator iterator() {
        return new ProjectIterator(projectList);
    }
}
